//package com.gec.anan.rules.config;
//
//import org.bouncycastle.cms.PasswordRecipientId;
//import org.kie.api.KieServices;
//import org.kie.api.builder.KieBuilder;
//import org.kie.api.builder.KieFileSystem;
//import org.kie.api.builder.KieModule;
//import org.kie.api.builder.model.KieModuleModel;
//import org.kie.api.runtime.KieContainer;
//import org.kie.internal.io.ResourceFactory;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class DroolsConfig {
//
//    private static final String RULES_CUSTOMER_RULES_DRL = "rules/FeeRule.drl";
//    @Bean
//    public KieContainer getKieContainer(){
//        //获取kieServices实例
//        KieServices kieServices = KieServices.Factory.get();
//        //读取规则文件
//        KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
//        kieFileSystem.write(ResourceFactory.newClassPathResource(RULES_CUSTOMER_RULES_DRL));
//        //获取builder
//        KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
//        kieBuilder.buildAll();
//        //获取modules
//        KieModule kieModule = kieBuilder.getKieModule();
//        return kieServices.newKieContainer(kieModule.getReleaseId());
//    }
//}
